﻿using System;
using GeoAPI.Geometries;

namespace NetTopologySuite.Precision
{
	public class CoordinatePrecisionReducerFilter : ICoordinateSequenceFilter
	{
		public CoordinatePrecisionReducerFilter(IPrecisionModel precModel)
		{
			this._precModel = precModel;
		}

		public void Filter(ICoordinateSequence seq, int i)
		{
			seq.SetOrdinate(i, Ordinate.X, this._precModel.MakePrecise(seq.GetOrdinate(i, Ordinate.X)));
			seq.SetOrdinate(i, Ordinate.Y, this._precModel.MakePrecise(seq.GetOrdinate(i, Ordinate.Y)));
		}

		public bool Done
		{
			get
			{
				return false;
			}
		}

		public bool GeometryChanged
		{
			get
			{
				return true;
			}
		}

		private readonly IPrecisionModel _precModel;
	}
}
